<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
  <th:block th:include="wx/include :: header('订单列表')" />
</head>
<body ontouchstart>
<header class="wy-header" style="position:fixed; top:0; left:0; right:0; z-index:200;">
  <div class="wy-header-icon-back" onclick="javascript:history.go(-1)"><span></span></div>
  <div class="wy-header-title">我的车库</div>
</header>
<div class='weui-content'>
  <div class="weui-tab">
    <div class="weui-navbar" style="position:fixed; top:44px; left:0; right:0; height:44px; background:#fff;">
      <a class="weui-navbar__item proinfo-tab-tit font-14 weui-bar__item--on" href="#tab1">已购买车模
        (<span th:text="${orderList.size()}"></span>)
      </a>
      <a class="weui-navbar__item proinfo-tab-tit font-14" href="#tab2">收藏车模
        (<span th:text="${collectGoodsList.size()}"></span>)
      </a>
    </div>
    <div class="weui-tab__bd proinfo-tab-con" style="padding-top:87px;">
      <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active">
        <div class="weui-panel weui-panel_access" th:each="order : ${orderList}">
          <div class="weui-panel__hd">
            <span th:text="${'单号：' + order.orderId}"></span>
            <span class="ord-status-txt-ts fr" style="color: #cccccc" th:if="${order.paymentResult == '1'}">交易成功</span>
            <span class="ord-status-txt-ts fr" th:if="${order.paymentResult == '0'}">待付款</span>
          </div>
          <div class="weui-media-box__bd  pd-10">
            <div class="weui-media-box_appmsg ord-pro-list"  th:each="orderItem : ${order.orderItemList}">
              <div class="weui-media-box__hd"><a href="javascript:;"><img class="weui-media-box__thumb" th:src="${orderItem.goodsImage}" alt=""></a></div>
              <div class="weui-media-box__bd">
                <h1 class="weui-media-box__desc"><a href="javascript:;" class="ord-pro-link" th:text="${orderItem.goodsName}"></a></h1>
                <!--<p class="weui-media-box__desc">规格：<span>红色</span>，<span>23</span></p>-->
                <div class="clear mg-t-10">
                  <div class="wy-pro-pri fl">¥<em class="num font-15" th:text="${orderItem.price}"></em></div>
                  <div class="pro-amount fr"><span class="font-13">数量×<em class="name"  th:text="${orderItem.num}">1</em></span></div>
                </div>
              </div>
            </div>
          </div>
          <div class="ord-statistics">
            <span>共<em class="num" th:text="${order.size}">1</em>件商品，</span>
            <span class="wy-pro-pri">总金额：¥<em class="num font-15"  th:text="${order.totalPrice}"></em></span>
          </div>
          <div class="weui-panel__ft" th:if="${order.paymentResult == '0'}">
            <div class="weui-cell weui-cell_access weui-cell_link oder-opt-btnbox">
              <a th:href="${'/wx/order_info/' + order.orderId}" class="ords-btn-com" th:attr="orderId=${order.orderId}">前去支付</a>
              <a href="javascript:;" class="ords-btn-dele" th:attr="orderId=${order.orderId}">删除订单</a>
            </div>    
          </div>
          <div class="weui-panel__ft" th:if="${order.paymentResult != '0'}">
            <div class="weui-cell weui-cell_access weui-cell_link oder-opt-btnbox">
              <a th:href="${'/wx/order_info/' + order.orderId}" class="ords-btn-com" th:attr="orderId=${order.orderId}">查看订单详情</a>
            </div>
          </div>
        </div>
      </div>
      <div id="tab2" class="weui-tab__bd-item" style="padding-top: 10px;">

        <div class="wy-Module">
          <div class="wy-Module-con">
            <ul class="wy-pro-list clear">
              <li th:each="newGoods : ${collectGoodsList}" >
                <a th:href="${'/wx/pro_info/' + newGoods.goodsId}">
                  <div class="proimg"><img th:src="${newGoods.mainImage}"/></div>
                  <div class="protxt">
                    <div class="name" th:text="${newGoods.goodsName}"></div>
                    <div class="wy-pro-pri">
                      ¥<span th:text="${newGoods.price}">#</span>
                      &nbsp;&nbsp;<em class="num font-12" style="text-decoration: line-through;color:#999999;" th:text="'¥' + ${newGoods.originalPrice}"></em>
                      <span style="float: right;color:#999999;font-size: 12px;"><em th:text="${newGoods.volume}"></em>人付款</span>
                    </div>
                  </div>
                </a>
              </li>
            </ul>
          </div>
        </div>

      </div>
    </div>
  </div>
</div>

<th:block th:include="wx/include :: foot-black" />
<th:block th:include="wx/include :: footer" />
<script type="text/javascript">
    $(".ords-btn-dele").on("click", function() {
        var orderId = $(this).attr('orderId');
        $.confirm("是否确认删除订单?", "", function() {
           $.post('/wx/order/del/' + orderId, function(resp){
                window.location.reload();
            });
        }, function() {
            //取消操作
        });
    });
</script>
</body>
</html>
